package com.example.mqttmodule.subscribe;

import lombok.extern.log4j.Log4j2;
import org.dromara.mica.mqtt.spring.server.MqttServerFunction;
import org.springframework.stereotype.Component;
import org.tio.core.ChannelContext;

@Component
@Log4j2
public class MqttSubscriber {
    @MqttServerFunction("/test/${xxxx}")
    public void handleMessage(ChannelContext context, String topic, byte[] payload) {
        log.info("Received message from topic: {}, content: {}", topic, new String(payload));
    }
}
